package com.gkzf.ai.module.crm.controller.admin.product.vo.product;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fhs.core.trans.anno.Trans;
import com.fhs.core.trans.constant.TransType;
import com.fhs.core.trans.vo.VO;
import com.gkzf.ai.framework.excel.core.annotations.DictFormat;
import com.gkzf.ai.framework.excel.core.convert.DictConvert;
import com.gkzf.ai.module.crm.controller.admin.product.vo.productadmittancecondition.ProductAdmittanceConditionRespVO;
import com.gkzf.ai.module.crm.controller.admin.product.vo.repayment.CrmProductRepaymentListReqVO;
import com.gkzf.ai.module.crm.enums.DictTypeConstants;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.List;

import static com.gkzf.ai.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;

@Schema(description = "管理后台 - CRM 产品 Response VO")
@Data
@ExcelIgnoreUnannotated
public class CrmProductRespVO implements VO {

    @Schema(description = "产品编号", example = "20529")
    @ExcelProperty("产品编号")
    private Long id;

    @Schema(description = "产品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "好产品")
    @ExcelProperty("产品名称")
    private String name;

    @Schema(description = "产品编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "12306")
    @ExcelProperty("产品编码")
    private String no;

    @Schema(description = "贷款期限", requiredMode = Schema.RequiredMode.REQUIRED,example = "2")
    @ExcelProperty(value = "贷款期限", converter = DictConvert.class)
    @DictFormat(DictTypeConstants.CRM_PRODUCT_UNIT)
    private Integer loansDeadline;

    @Schema(description = "最大限额", requiredMode = Schema.RequiredMode.REQUIRED, example = "8911")
    @ExcelProperty("最大限额")
    private BigDecimal maxQuota;

    /**
     * 产品有效期开始时间
     */
    @Schema(description = "产品有效期开始时间", example = "2024-09-01",requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty( "产品有效期开始时间")
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
    private LocalDate validityPeriodStart;
    /**
     * 产品有效期结束时间
     */
    @Schema(description = "产品有效期结束时间", example = "2024-09-01",requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty( "产品有效期结束时间")
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
    private LocalDate validityPeriodEnd;

    /**
     * 利率
     */
    @Schema(description = "利率(%)", example = "2.34")
    @ExcelProperty( "利率(%)")
    private String interestRate;

    /**
     * 下款方式
     */
    @Schema(description = "下款方式", example = "线上")
    @ExcelProperty( "下款方式")
    private String payeeWay;
    /**
     * 办理周期
     */
    @Schema(description = "办理周期", example = "0")
    @ExcelProperty( "办理周期")
    private Integer processingCycle;

    /**
     * 贷款类型
     */
    @Schema(description = "贷款类型", example = "信用贷")
    @ExcelProperty( "贷款类型")
    private String loanType;
    /**
     * 状态
     */
    @Schema(description = "状态", example = "0 上架  1 下架")
    @ExcelProperty( "状态")
    private Integer status;

    @Schema(description = "创建人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
    @Trans(type = TransType.SIMPLE, targetClassName = "com.gkzf.ai.module.system.dal.dataobject.user.AdminUserDO",
            fields = "nickname", ref = "creatorName")
    private String creator;

    @Schema(description = "创建人名字", requiredMode = Schema.RequiredMode.REQUIRED, example = "国科智飞")
    @ExcelProperty("创建人")
    private String creatorName;

    /**
     * 产品准备材料
     */
    @Schema(description = "产品准备材料", example = "0,1")
    @ExcelProperty( "产品准备材料")
    private String preparedMaterials;

    @Schema(description = "产品描述备注", example = "你说的对")
    @ExcelProperty("产品描述备注")
    private String description;

    @Schema(description = "是否有准入条件", example = "1")
    @ExcelProperty("是否有准入条件")
    private Integer isAccess;

    @Schema(description = "还款对象对象集合", requiredMode = Schema.RequiredMode.REQUIRED, example = "还款对象集合")
    @ExcelProperty( "还款对象")
    private List<CrmProductRepaymentListReqVO> createRepaymentVOList;

    @Schema(description = "合作机构 字典配置")
    private Integer cooperationInstitution;

    @Schema(description = "额度公式")
    private String quotaFormula;

    @Schema(description = "产品介绍")
    private String descriptions;

    @Schema(description = "产品标签")
    private String label;
    /**
     *  是否推送app端
     */
    @Schema(description = "是否推送app端")
    private Integer isPushRemotely;


    /**
     *  是否推送推荐 默认0不推荐  1推荐
     */
    @Schema(description = "是否推送推荐 默认0不推荐  1推荐")
    private Integer isRecommendation;

    @Schema(description = "申请流程")
    private String applicationProcess;


    @Schema(description = "准入条件对象")
    private ProductAdmittanceConditionRespVO conditionReqVO;

}
